/*
 * Copyright (C) 2008
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.sca4idea.providers;

import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.Nullable;

/**
 * Registry for maintaining the list of available SCA providers, and their implementation configurations.
 */
public abstract class SCAProviderRegistry {
    /**
     * Retrieves an instance of the registry.
     * @return the registry.
     */
    public static SCAProviderRegistry getInstance() {
        return ServiceManager.getService(SCAProviderRegistry.class);
    }

    /**
     * Retrieves all providers known to the registry.
     * @return all known providers.
     */
    public abstract SCAProvider[] getAllProviders();

    /**
     * Retrieves a provider based upon its id.
     * @param id the identitifer of the provider.
     * @return the provider, or null if the provider cannot be found.
     */
    @Nullable
    public abstract SCAProvider getProviderById(String id);

    /**
     * Registers a provider that is statically configured within the plugin.
     * @param provider the provider instance.
     */
    public abstract void registerStaticProvider(SCAProvider provider);

    /**
     * Requests that the registry register references for all known providers.
     * @param factory the registrar factory.
     */
    public abstract void registerReferences(ProviderReferenceRegistrarFactory factory);
}
